package com.nts.visionworks.core.security.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * SecurityAuthority generated by hbm2java
 */
@Entity
@Table(name = "security_authority", catalog = "visionworks", uniqueConstraints =
{ @UniqueConstraint(columnNames = "AuthorityName"),
		@UniqueConstraint(columnNames = "AuthorityKey") })
public class SecurityAuthority implements java.io.Serializable
{

	private Integer authorityId;
	private String authorityKey;
	private String authorityName;
	private Set<SecurityAuthorityFunction> securityAuthorityFunctions = new HashSet<SecurityAuthorityFunction>(
			0);
	private Set<SecurityIdentity> securityIdentities = new HashSet<SecurityIdentity>(
			0);

	public SecurityAuthority()
	{
	}

	public SecurityAuthority(String authorityKey, String authorityName)
	{
		this.authorityKey = authorityKey;
		this.authorityName = authorityName;
	}

	public SecurityAuthority(String authorityKey, String authorityName,
			Set<SecurityAuthorityFunction> securityAuthorityFunctions,
			Set<SecurityIdentity> securityIdentities)
	{
		this.authorityKey = authorityKey;
		this.authorityName = authorityName;
		this.securityAuthorityFunctions = securityAuthorityFunctions;
		this.securityIdentities = securityIdentities;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "AuthorityId", unique = true, nullable = false)
	public Integer getAuthorityId()
	{
		return this.authorityId;
	}

	public void setAuthorityId(Integer authorityId)
	{
		this.authorityId = authorityId;
	}

	@NotNull(message = "validation.securityAuthority.authorityKey.notNull")
	@Size(message = "validation.securityAuthority.authorityKey.length", max = 50, min = 1)
	@Column(name = "AuthorityKey", unique = true, nullable = false, length = 50)
	public String getAuthorityKey()
	{
		return this.authorityKey;
	}

	public void setAuthorityKey(String authorityKey)
	{
		this.authorityKey = authorityKey;
	}

	@NotNull(message = "validation.securityAuthority.authorityName.notNull")
	@Size(message = "validation.securityAuthority.authorityName.length", max = 200, min = 1)
	@Column(name = "AuthorityName", unique = true, nullable = false, length = 200)
	public String getAuthorityName()
	{
		return this.authorityName;
	}

	public void setAuthorityName(String authorityName)
	{
		this.authorityName = authorityName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "securityAuthority")
	public Set<SecurityAuthorityFunction> getSecurityAuthorityFunctions()
	{
		return this.securityAuthorityFunctions;
	}

	public void setSecurityAuthorityFunctions(
			Set<SecurityAuthorityFunction> securityAuthorityFunctions)
	{
		this.securityAuthorityFunctions = securityAuthorityFunctions;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "securityAuthority")
	public Set<SecurityIdentity> getSecurityIdentities()
	{
		return this.securityIdentities;
	}

	public void setSecurityIdentities(Set<SecurityIdentity> securityIdentities)
	{
		this.securityIdentities = securityIdentities;
	}

}
